<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = 'joinnumber';	//語言檔參數，務必放在最前面
$intLottoID = empty($_data["LottoID"])?1:(int)$_data["LottoID"];

include_once(__Member_Path."/logincheck_nodb.php");
$objMemberInfo = $_SESSION["Member_Info"];

include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/todaygame/Gamble". $intLottoID.".inc.php");
include_once(__Common_Path."/gambletype/GambleType". $objMemberInfo -> GambleType."_".$intLottoID.".inc.php");


//取得 TodayGame 資料
for($intBT = 7; $intBT <= 11; $intBT++) {
	include_once(__Common_Path."/todaygame/TodayGame".$intLottoID."_".$intBT.".inc.php");
}

$isStart = false;
if (!is_array($_arrTodayGame) || !is_array($_arrGamble)) {
	$strTemplateFile = __Membertemplate_Path."/joinnumber_isstop.html";

}else{
	list($intGID, $arrGData) = each($_arrGamble);

	//判斷是否有 Game 時間是否過期
	$GameEndDateTime	= $arrGData["GameDate"] .' '. $arrGData["EndGameTime"];
	$NowDateTime		= date("Y-m-d") .' '. date("H:i:s");

	if ($NowDateTime > $GameEndDateTime) {
		$strTemplateFile = __Membertemplate_Path."/joinnumber_isstop.html";

	} else {
		$isStart = true;
		$strTemplateFile = __Membertemplate_Path."/joinnumber.html";
		$arrTodayGame = $_arrTodayGame[$intGID];
	}
}

$fp = @file($strTemplateFile);
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{ShowSid}", $_data["sid"], $fp);
$fp = str_replace("{ShowLottoID}", $intLottoID, $fp);
$fp = str_replace("{ShowSerialNo}", $arrGData["SerialNo"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGData["GameDate"], $fp);
$fp = str_replace("{ShowGameTime}", $arrGData["GameTime"], $fp);
$fp = str_replace("{MaxOfJoinNumber}", $_KSysParam["MaxOfJoinNumber"], $fp);
$fp = str_replace("{ColorSet}", $_arrLotto[$intLottoID]["ColorSet"], $fp);
$fp = str_replace("{DrawSpecial}", $_arrLotto[$intLottoID]["DrawSpecial"], $fp);
$fp = str_replace("{SpecialOverNumber}", $_arrLotto[$intLottoID]["SpecialOverNumber"], $fp);
$fp = str_replace("{Mantissa}", $_strSame_String["Mantissa"], $fp);

if($isStart){
	for($intBT = 7; $intBT <= 11; $intBT++){
		$fp = str_replace("{BTStop".$intBT."}", $arrTodayGame[$intBT][0]["isStopBet"], $fp);

		if($arrTodayGame[$intBT][0]["isStopBet"]){
			$strOdds = '<script language="javascript">window.BTOdds'.$intBT.'.className="rt_jn_odds_grey";</script>'. $_strJoinNumber["IsStop"];
		}else{
			if($intBT == 8){
				$strOdds = '<a class="rt_jn_odds">'.  $_strJoinNumber[WinTwo].'</a><em>'.$arrTodayGame[$intBT][0]["Odds"].'</em><br /><a class="rt_jn_odds">'. $_strJoinNumber[WinThree] .'</a><em>'. $arrTodayGame[8][1][Odds].'</em>';
			}elseif($intBT == 10){
				$strOdds = '<a class="rt_jn_odds">'. $_strJoinNumber[WinSpecial].'</a><em>'.$arrTodayGame[$intBT][0]["Odds"].'</em><br /><a class="rt_jn_odds">'. $_strJoinNumber[WinTwo] .'</a><em>'. $arrTodayGame[10][1][Odds].'</em>';
			}else{
				$strOdds = '<a class="rt_jn_odds">'. $_arrBet_Type[1][$intBT].'</a><em>'.$arrTodayGame[$intBT][0]["Odds"].'</em>';
			}
		}
		$fp = str_replace("{BTOdds".$intBT."}", $strOdds, $fp);
	}
}

while(list($k, $v) = each($_strJoinNumber)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

foreach($_arrAnimals as $k => $strAn){
	if($k == 0)continue;
	$fp = str_replace("{An".$k."}", $strAn, $fp);
}
//輸出
WebOutputHTML($fp, 1);
?>